<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
*/

/**
 * Description of Email
 *
 * @author chaporgin_a
 */
class VA_Form_Validator_Email extends VA_Form_Validator_Regexp {
  public function init($options){
    parent::init($options);
    $this->message = $this->getOption('message', 'Введите правильный email');
    $this->expr = '/^(.+)@([^@]+)$/';
  }
  public function isValid($value) {
    if(!empty ($value) && ((strpos($value, '..') !== false) or !$this->checkRegexp($value))){
      $this->errorMessages[] = $this->message;
      return FALSE;
    }
    return TRUE;
  }
  public function getHTMLTagAttributes() {
    return array('email' => array('true'));
  }
}

